package cn.cdeden.system.api.domain.enums;

//import com.cdyd.ecm.utils.StringUtils;
import cn.cdeden.common.core.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;
//import org.apache.commons.lang3.StringUtils;

/**
 * TODO
 *
 * @author username
 * @date 2023/12/6 10:24
 * @describe:
 **/
@Getter
@AllArgsConstructor
public enum EnterprisePermTypeEnum {
    NO("no","无任何权限","no",7),
    QUERY("query","查看","query",6),
    PRINT("print","打印","query,print",5),
    DOWNLOAD("download","下载","query,print,download",4),
    EDITOR("editor","编辑","query,print,download,editor",3),
    UPLOAD("upload","上传","query,print,download,editor,upload",2),
    MANAGE("manage","管理","query,print,download,editor,upload,manage",1);
    private final String permTypeCode;
    private final String permTypeName;
    private final String permIncludes;
    private final Integer permRank;


    public static EnterprisePermTypeEnum getPermTypeEnum(String permTypeCode) {
        if (StringUtils.isNullOrBlank(permTypeCode)) return NO;
        for (EnterprisePermTypeEnum enterprisePermTypeEnum : EnterprisePermTypeEnum.values()) {
            if (enterprisePermTypeEnum.getPermTypeCode().equals(permTypeCode)) {
                return enterprisePermTypeEnum;
            }
        }
        return NO;
    }
}
